package com.sky.mapper.admin;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.sky.pojo.Setmeal;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper extends BaseMapper<Setmeal> {

    /**
     * 根据分类id查询套餐的数量
     * @param id
     * @return
     */
    @Select("select count(id) from setmeal where category_id = #{categoryId}")
    Integer countByCategoryId(Long id);

    //新增套餐
    void saveSetmeal(Setmeal setmeal);

    //根据ID批量删除
    void deleteSetmeal(@Param("id") List<Integer> ids);

    //修改套餐
    void putSetmeal(Setmeal setmeal);

    //条件分页查询
    Page<SetmealVO> pageSetmeal(Integer categoryId, String name, Integer status);

    void setmealStatus(Integer status, Integer id);


    Setmeal selectById(Long id);
}
